import time
from Base.Base import Base
from utils.data_helper import read_page_yaml


class Product(Base):
    def __init__(self, driver):
        super().__init__(driver)
        # check_config.py 中调用（假设需要 product_page）
        self.elem_dict = read_page_yaml('product_page')
        time.sleep(1)
# 【支付产品信息】:
    def zfgl(self):
        self.click(self.elem_dict['set_zfgl'])
        time.sleep(1)
    def zfcpxx(self):
        self.click(self.elem_dict['set_zfcpxx'])
        time.sleep(1)
    def addzfcp(self):
        self.click(self.elem_dict['set_addzfcp'])
        time.sleep(1)
    def zfyhbm(self,zfyhbm):
        self.send_keys(self.elem_dict['set_zfyhbm'],zfyhbm)
        time.sleep(1)
    def zfcpname(self,zfcpname):
        self.send_keys(self.elem_dict['set_zfcpname'],zfcpname)
        time.sleep(1)
    def djtj(self):
        self.click(self.elem_dict['set_djtj'])
        time.sleep(4)
    def shuruname(self,shuruname):
        self.send_keys(self.elem_dict['set_shuruname'],shuruname)
        time.sleep(1)
    def djselect(self):
        self.click(self.elem_dict['set_djselect'])
        time.sleep(1)
    #设置支付方式:
    def zffs(self):
        self.click(self.elem_dict['set_zffs'])
        time.sleep(1)
    def addzffs(self):
        self.click(self.elem_dict['set_addzffs'])
        time.sleep(1)
    def zfflv(self,zfflv):
        self.send_keys(self.elem_dict['set_zfflv'],zfflv)
        time.sleep(1)
    def djtj3(self):
        self.click(self.elem_dict['set_djtj3'])
        time.sleep(3)
    def djsj(self):
        self.click(self.elem_dict['set_djsj'])
        time.sleep(4)
    def djqd(self):
        self.click(self.elem_dict['set_djqd'])
        time.sleep(1)
# 【支付产品配置】:
    def djyhzfpz(self):
        self.click(self.elem_dict['set_djyhzfpz'])
        time.sleep(1)
    def addzfpz(self):
        self.click(self.elem_dict['set_addzfpz'])
        time.sleep(4)
    def yhbh(self,yhbh):
        self.send_keys(self.elem_dict['set_yhbh'],yhbh)
        time.sleep(1)
    def yhm(self,yhm):
        self.send_keys(self.elem_dict['set_yhm'],yhm)
        time.sleep(1)
    def zfcpbh(self,zfcpbh):
        self.send_keys(self.elem_dict['set_zfcpbh'],zfcpbh)
        time.sleep(1)
    def zfcpmc(self,zfcpmc):
        self.send_keys(self.elem_dict['set_zfcpmc'],zfcpmc)
        time.sleep(1)
    def fxycq(self,fxycq):
        self.send_keys(self.elem_dict['set_fxycq'],fxycq)
        time.sleep(1)
    def djtj2(self):
        self.click(self.elem_dict['set_djtj2'])
        time.sleep(4)
    def yhm2(self,yhm2):
        self.send_keys(self.elem_dict['set_yhm2'],yhm2)
        time.sleep(1)
    def zfcpmc2(self,zfcpmc2):
        self.send_keys(self.elem_dict['set_zfcpmc2'],zfcpmc2)
        time.sleep(1)
    def djselect2(self):
        self.click(self.elem_dict['set_djselect2'])
        time.sleep(1)

    def dy1(self):#查询产品列表中的名称（小样儿）
        return self.by(self.elem_dict['set_dy1'])
    def dy2(self):#查询产品配置中的名称(华为Mate30)
        return self.by(self.elem_dict['set_dy2'])
